package com.redis.base;

import redis.clients.jedis.Jedis;

/**
 * @author ：qs
 * @date ：Created in 2021/8/14
 * @description：链接测试
 * @modified By：
 */
public class ConnectTest {

    public static void main(String[] args) {
        Jedis jedis = new Jedis("39.103.204.17", 6379);

        // 链接测试
        System.out.println(jedis.ping());

        System.out.println("清空数据：" + jedis.flushDB());
        System.out.println("判断某个建是否存在：" + jedis.exists("key1"));
        System.out.println("新增<'username','aoyama'>键值对：" + jedis.set("username", "aoyama"));
        System.out.println("获取username：" + jedis.get("username"));
        jedis.close();

    }
}
